package com.uex.dev.manage.admin.vo.project;

import com.uex.dev.manage.admin.po.ProjectPO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import java.util.Objects;

/**
 * @author lzs
 * @create 2024/03/12
 * @description
 */
@Schema(description = "项目列表响应参数")
@Getter
@Setter
public class ProjectListResp extends ProjectInfo {
    @Schema(description = "项目Id")
    private Integer prjId;

    public static ProjectListResp fromPO(ProjectPO project) {
        ProjectListResp projectListResp = new ProjectListResp();
        BeanUtils.copyProperties(project, projectListResp);
        projectListResp.setPrjWorkModeDesc(Objects.nonNull(project.getPrjWorkMode()) ? project.getPrjWorkMode().getDesc() : "-");
        return projectListResp;
    }
}

